﻿@model ChiDao.Site.Models.HolidayDocumentView
@{
    ViewBag.Title = "QueryHolidayDocument";
    Layout = "~/Views/Shared/_BaseLayout.cshtml";
    var X = Html.X();
}
<h2>
    QueryHolidayDocument</h2>
@section headtag
{
    <script>
        var saveSuccess = function () {
            App.btnNext.enable();
        };        
    </script>
}
@section example
{
    @(X.Viewport()
            .Layout(LayoutType.Anchor)
            .Items(
                    X.TabPanel()
                        .Items(
                                X.Panel()
                                    .Title("请假申请审批")
                                    .Items(
                                        X.Panel()
                                            .Region(Region.North)
                                            .Margins("5 5 5 5")
                                            .Items(
                                                X.Button()
                                                    .ID("btnSave")
                                                    .Text("保存")
                                                    .DirectEvents(de =>
                                                    {
                                                        de.Click.Url = Url.Action("SaveData");
                                                        de.Click.ExtraParams.Add(new Parameter("id", "App.hID.value", ParameterMode.Raw));
                                                        de.Click.ExtraParams.Add(new Parameter("requestDate", "App.dfRequestDate.rawValue", ParameterMode.Raw));
                                                        de.Click.ExtraParams.Add(new Parameter("description", "App.taDescription.value", ParameterMode.Raw));
                                                    }),
                                                X.Button()
                                                    .ID("btnBack")
                                                    .Text("回退")
                                                    .DirectEvents(de =>
                                                    {
                                                        de.Click.Url = Url.Action("BackData");
                                                        de.Click.ExtraParams.Add(new Parameter("id", "App.hID.value", ParameterMode.Raw));
                                                    }),
                                                X.Button()
                                                    .ID("btnNext")
                                                    .Text("流转")
                                                    .DirectClickAction("CirculationWindow")
                                                    ),
                                        X.Panel()
                                            .Region(Region.Center)
                                            .Margins("5 5 5 5")
                                            .Items(
                                                X.FormPanel()
                                                    .Title("Details")
                                                    .BodyPadding(5)
                                                    .FieldDefaults(fd => fd.LabelWidth = 80)
                                                    .Items(
                                                        X.Hidden()
                                                            .ID("hID")
                                                            .Text(Model.ID.ToString()),
                                                        X.Hidden()
                                                            .ID("hHandleState")
                                                            .Text(Model.HandleState),
                                                        X.TextField()
                                                            .ID("txtRequestPerson")
                                                            .Text(Model.RequestPerson)
                                                            .FieldLabel("申请人")
                                                            .AnchorHorizontal("100%"),
                                                        X.DateField()
                                                            .ID("dfRequestDate")
                                                            .SelectedDate(Model.RequestDate)
                                                            .FieldLabel("申请时间")
                                                            .AnchorHorizontal("100%"),
                                                        X.TextArea()
                                                            .ID("taDescription")
                                                            .Text(Model.Description)
                                                            .FieldLabel("申请原因")
                                                            .AnchorHorizontal("100%")
                                                            )
                                                    ),
                                            X.Panel()
                                                    .Region(Region.South)
                                                    .Margins("5 5 5 5")
                                                    .Items(
                                                        X.GridPanel()
                                                            .ID("gpProcessList")
                                                            .Region(Region.Center)
                                                            .Title("处理列表")
                                                            .Store(X.Store()
                                                                    .Model(X.Model()
                                                                        .Fields(
                                                                                new ModelField("CurrentProcessNodeName", ModelFieldType.String),
                                                                                new ModelField("ApprovalOpinion", ModelFieldType.String),
                                                                                new ModelField("CurrentProcessPerson", ModelFieldType.String),
                                                                                new ModelField("ProcessTime", ModelFieldType.Date)
                                                                                )
                                                                            )
                                                                    .DataSource(Model.lstBaklogTask)
                                                                    )
                                                                .ColumnModel(
                                                                                X.Column().Text("ProcessNode").DataIndex("CurrentProcessNodeName").Flex(1),
                                                                                X.Column().Text("ApprovalOpinion").DataIndex("ApprovalOpinion"),
                                                                                X.Column().Text("ProcessPerson").DataIndex("CurrentProcessPerson"),
                                                                                X.DateColumn().Text("ProcessTime").DataIndex("ProcessTime").Format("yyyy-MM-dd")
                                                                            )
                                                            )
                                                ),
                                X.Panel()
                                    .ID("previewGraph")
                                    .Title("流程图")
                                    .Height(600)                             
                                    .Loader(X.ComponentLoader()
                                                .Url(Url.Action("GenerateGraph"))
                                                .Params(new Parameter("processID", "App.hID.value", ParameterMode.Raw))
                                                .Params(new Parameter("processCode", "HolidayDocument"))                                                
                                                .Mode(LoadMode.Frame)
                                                .LoadMask(lm => lm.ShowMask = true)
                                            )
                                )
                           )
                     )
}

